Blog

Curt Gratz

July 21, 2010

Spread the word


Share your thoughts

Have you ever wanted a quick and easy way to combine arrays in ColdFusion.  I have done this a number of ways in the best, but came across this gem and thought I would share.

All ColdFusion arrays are of the Java vector type, we can use the underlying java.util.Vector class methods, specifically the addAll() method.

Keep in mind that this is not a "documented" use of arrays in ColdFusion, so at any version it may stop working.

Merging two arrays in ColdFusion with the java.util.vector.addAll()

ar1 = ["a","b","c"]; ar2 = ["d","e","f"]; ar1.addAll(ar2); writeDump(ar1);

 

Add Your Comment

(1)

Dec 10, 2010 10:43:30 UTC

by Adam lewis

Thanks for the coding nugget. That pretty slick.

Recent Entries

Building Native CLI Apps with MatchBox & Native Fusion

Building Native CLI Apps with MatchBox & Native Fusion

MatchBox makes BoxLang practical for a classic deployment target: the single-file command-line application.

The MatchBox open beta is available at https://github.com/ortus-boxlang/matchbox.

With the MatchBox native target, you can compile a .bxs script into a standalone executable for macOS, Linux, or Windows. The generated binary includes the MatchBox VM core and your compiled BoxLang bytecode. It does not require a JVM, a separate MatchBox install, or any runtime on the target machine.

Jacob Beers
Jacob Beers
July 14, 2026